/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VentanaPrincipalView.java
 *
 * Created on 11/03/2014, 06:10:17 PM
 */

package py.com.sysvent.view;
import javax.swing.*;
import py.com.sysvent.utilitarios.*;

/**
 *
 * @author Miguel
 */
public class VentanaPrincipalView extends javax.swing.JFrame {
    data mostrar_datos;
    String set_look = "com.sun.java.swing.plaf.metal.MetalLookAndFeel"; 
    /** Creates new form VentanaPrincipalView */
    public VentanaPrincipalView() {
        initComponents();
        mostrar_datos = new data();
        mostrar_datos.el_dato();//primero tengo que ejecutar este metodo para despues ejecutar el resto
       lbl_data.setText("Hoy es "+mostrar_datos.dia_semana+ " "+mostrar_datos.dia+" de "+mostrar_datos.mes+" del año "+mostrar_datos.anho);
       timer1.start();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        timer1 = new org.netbeans.examples.lib.timerbean.Timer();
        jPanel1 = new javax.swing.JPanel();
        btn_cliente = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        lbl_data = new javax.swing.JLabel();
        lbl_hora = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jm_registros = new javax.swing.JMenu();
        jmi_cliente = new javax.swing.JMenuItem();
        jmi_direccion = new javax.swing.JMenuItem();
        jmi_telefono = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        jmi_tipoPago = new javax.swing.JMenuItem();
        jmi_funcionarios = new javax.swing.JMenuItem();
        jmi_cargo = new javax.swing.JMenuItem();
        jmi_departamento = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        jmi_proveedores = new javax.swing.JMenuItem();
        jSeparator3 = new javax.swing.JPopupMenu.Separator();
        jmi_producto = new javax.swing.JMenuItem();
        jmi_unidad = new javax.swing.JMenuItem();
        jSeparator4 = new javax.swing.JPopupMenu.Separator();
        jmi_salir = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();
        jmi_ventas = new javax.swing.JMenuItem();
        jmi_presupuesto = new javax.swing.JMenuItem();
        jm_reportes = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();
        jm_nimbus = new javax.swing.JMenuItem();
        jmi_liquid = new javax.swing.JMenuItem();
        jMenu5 = new javax.swing.JMenu();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();

        timer1.addTimerListener(new org.netbeans.examples.lib.timerbean.TimerListener() {
            public void onTime(java.awt.event.ActionEvent evt) {
                timer1OnTime(evt);
            }
        });

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Sistema de Ventas");

        jPanel1.setBackground(new java.awt.Color(0, 51, 51));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 500, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 25, Short.MAX_VALUE)
        );

        btn_cliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/user-32.png"))); // NOI18N
        btn_cliente.setText("Cliente");

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/politecnica.png"))); // NOI18N
        jLabel1.setText("jLabel1");

        lbl_data.setText("Fecha:.");

        lbl_hora.setText("Hora:.");

        jm_registros.setMnemonic('R');
        jm_registros.setText("Registros");

        jmi_cliente.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        jmi_cliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/clientes.png"))); // NOI18N
        jmi_cliente.setText("Cliente");
        jmi_cliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmi_clienteActionPerformed(evt);
            }
        });
        jm_registros.add(jmi_cliente);

        jmi_direccion.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.CTRL_MASK));
        jmi_direccion.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/ciudad.png"))); // NOI18N
        jmi_direccion.setMnemonic('D');
        jmi_direccion.setText("Dirección");
        jm_registros.add(jmi_direccion);

        jmi_telefono.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_MASK));
        jmi_telefono.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/barrio.png"))); // NOI18N
        jmi_telefono.setText("Teléfono");
        jm_registros.add(jmi_telefono);
        jm_registros.add(jSeparator1);

        jmi_tipoPago.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.ALT_MASK));
        jmi_tipoPago.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/icon-money.png"))); // NOI18N
        jmi_tipoPago.setText("Tipo de Pago");
        jm_registros.add(jmi_tipoPago);

        jmi_funcionarios.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.ALT_MASK));
        jmi_funcionarios.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/funcionario.png"))); // NOI18N
        jmi_funcionarios.setText("Funcionarios");
        jm_registros.add(jmi_funcionarios);

        jmi_cargo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        jmi_cargo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/cargo.png"))); // NOI18N
        jmi_cargo.setText("Cargo");
        jm_registros.add(jmi_cargo);

        jmi_departamento.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M, java.awt.event.InputEvent.CTRL_MASK));
        jmi_departamento.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/world.png"))); // NOI18N
        jmi_departamento.setText("Departamento");
        jmi_departamento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmi_departamentoActionPerformed(evt);
            }
        });
        jm_registros.add(jmi_departamento);
        jm_registros.add(jSeparator2);

        jmi_proveedores.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK));
        jmi_proveedores.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/user-32.png"))); // NOI18N
        jmi_proveedores.setText("Proveedores");
        jm_registros.add(jmi_proveedores);
        jm_registros.add(jSeparator3);

        jmi_producto.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        jmi_producto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/folder_camera.png"))); // NOI18N
        jmi_producto.setText("Producto");
        jm_registros.add(jmi_producto);

        jmi_unidad.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.SHIFT_MASK));
        jmi_unidad.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/wrench_orange.png"))); // NOI18N
        jmi_unidad.setText("Unidad");
        jmi_unidad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmi_unidadActionPerformed(evt);
            }
        });
        jm_registros.add(jmi_unidad);
        jm_registros.add(jSeparator4);

        jmi_salir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        jmi_salir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/salir.png"))); // NOI18N
        jmi_salir.setText("Salir");
        jm_registros.add(jmi_salir);

        jMenuBar1.add(jm_registros);

        jMenu1.setMnemonic('M');
        jMenu1.setText("Movimiento");

        jmi_ventas.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.SHIFT_MASK));
        jmi_ventas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/getmoney.png"))); // NOI18N
        jmi_ventas.setText("Ventas");
        jMenu1.add(jmi_ventas);

        jmi_presupuesto.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jmi_presupuesto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/money.png"))); // NOI18N
        jmi_presupuesto.setText("Presupuesto");
        jMenu1.add(jmi_presupuesto);

        jMenuBar1.add(jMenu1);

        jm_reportes.setMnemonic('e');
        jm_reportes.setText("Reportes");

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK));
        jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/relatorio.png"))); // NOI18N
        jMenuItem1.setText("Reporte de Ventas");
        jm_reportes.add(jMenuItem1);

        jMenuBar1.add(jm_reportes);

        jMenu4.setMnemonic('U');
        jMenu4.setText("Utilitarios");

        jm_nimbus.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.CTRL_MASK));
        jm_nimbus.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/application_double.png"))); // NOI18N
        jm_nimbus.setText("Look and Fell-Nimbus");
        jm_nimbus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jm_nimbusActionPerformed(evt);
            }
        });
        jMenu4.add(jm_nimbus);

        jmi_liquid.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        jmi_liquid.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/table.png"))); // NOI18N
        jmi_liquid.setText("Look and Fell_Liquid");
        jmi_liquid.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmi_liquidActionPerformed(evt);
            }
        });
        jMenu4.add(jmi_liquid);

        jMenuBar1.add(jMenu4);

        jMenu5.setMnemonic('S');
        jMenu5.setText("Seguridad");

        jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/lock.png"))); // NOI18N
        jMenuItem4.setText("Cambiar contraseña actual");
        jMenu5.add(jMenuItem4);

        jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/py/com/sysvent/graficos/key_delete.png"))); // NOI18N
        jMenuItem5.setText("Nivel de Acceso");
        jMenu5.add(jMenuItem5);

        jMenuBar1.add(jMenu5);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 490, Short.MAX_VALUE))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(btn_cliente)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(145, 145, 145)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lbl_hora)
                            .addComponent(lbl_data))))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btn_cliente)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 138, Short.MAX_VALUE)
                .addComponent(lbl_data)
                .addGap(2, 2, 2)
                .addComponent(lbl_hora)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-508)/2, (screenSize.height-434)/2, 508, 434);
    }// </editor-fold>//GEN-END:initComponents

    private void timer1OnTime(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timer1OnTime
        // TODO add your handling code here:
         mostrar_datos.leer_hora();
         lbl_hora.setText("Hora actual: "+mostrar_datos.hora);

    }//GEN-LAST:event_timer1OnTime

    private void jmi_liquidActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmi_liquidActionPerformed
        // TODO add your handling code here:
        set_look = "com.birosoft.liquid.LiquidLookAndFeel";
        
        lookandfeel();

    }//GEN-LAST:event_jmi_liquidActionPerformed

    private void jm_nimbusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jm_nimbusActionPerformed
        // TODO add your handling code here:
        //set_look = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
        //set_look = "javax.swing.plaf.metal.MetalLookAndFeel";
        set_look ="com.sun.java.swing.plaf.motif.MotifLookAndFeel";
        lookandfeel();
    }//GEN-LAST:event_jm_nimbusActionPerformed

    private void jmi_unidadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmi_unidadActionPerformed
        // TODO add your handling code here:
        String args[] = new String[1];
        args[0] = "Registro de Unidad de Producto";
        UnidadProductoView.main(args);

    }//GEN-LAST:event_jmi_unidadActionPerformed

    private void jmi_departamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmi_departamentoActionPerformed
        // ......
        String args[] = new String[1];
        args[0] = "Registro de Departamento";
        DepartamentoView.main(args);

    }//GEN-LAST:event_jmi_departamentoActionPerformed

    private void jmi_clienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmi_clienteActionPerformed
        // ....

        String args[] = new String[1];//creamos un vectorcito aqui de una sola posicion;
        args[0] = "Registro de Clientes";//es este el parametro que le pasamos a nuestro metodo main
        ClienteView.main(args);


    }//GEN-LAST:event_jmi_clienteActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VentanaPrincipalView().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btn_cliente;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JPopupMenu.Separator jSeparator3;
    private javax.swing.JPopupMenu.Separator jSeparator4;
    private javax.swing.JMenuItem jm_nimbus;
    private javax.swing.JMenu jm_registros;
    private javax.swing.JMenu jm_reportes;
    private javax.swing.JMenuItem jmi_cargo;
    private javax.swing.JMenuItem jmi_cliente;
    private javax.swing.JMenuItem jmi_departamento;
    private javax.swing.JMenuItem jmi_direccion;
    private javax.swing.JMenuItem jmi_funcionarios;
    private javax.swing.JMenuItem jmi_liquid;
    private javax.swing.JMenuItem jmi_presupuesto;
    private javax.swing.JMenuItem jmi_producto;
    private javax.swing.JMenuItem jmi_proveedores;
    private javax.swing.JMenuItem jmi_salir;
    private javax.swing.JMenuItem jmi_telefono;
    private javax.swing.JMenuItem jmi_tipoPago;
    private javax.swing.JMenuItem jmi_unidad;
    private javax.swing.JMenuItem jmi_ventas;
    private javax.swing.JLabel lbl_data;
    private javax.swing.JLabel lbl_hora;
    private org.netbeans.examples.lib.timerbean.Timer timer1;
    // End of variables declaration//GEN-END:variables
public void lookandfeel()
    {
     try
        {
        //La variable set look tiene que estar definida arriba como una variable String
        UIManager.setLookAndFeel(set_look);
        SwingUtilities.updateComponentTreeUI(this);//ella hace una actualización en el
        }
        catch (Exception error)
         {
           JOptionPane.showMessageDialog(null, error);
         }
        }
}
